package user;

import event.*;
import net.ClientCommunicator;
import game.Player;


/**
 * Admin class
 * 
 * Instances of this class will represent system administrators.
 */
public class Admin extends User {

	public Admin(ClientCommunicator communicator, Player player) {
		super(communicator, player);
	}
	
	
	/**
	 * Handles the LoginFailed event.
	 * Sends the error message to every admin.
	 */
	@Override
	public void loginFailedEventHandler(LoginFailedEventArgs args) {	
		this.send(args.getMessage());
	}
	
	
	/**
	 * Handles the AccountCreationFailed event.
	 * Sends the error message to every admin.
	 */
	public void accountCreationFailedEventHandler(AccountCreationFailedEventArgs args) {
		this.send(args.getMessage());
	}


	/**
	 * Handles the AccountCreationSuccessful event.
	 * Sends a confirmation message to every admin.
	 */
	public void accountCreationSuccessfulEventHandler(AccountCreationSuccessfulEventArgs args) {
		this.send(args.getMessage());
	}


	/**
	 * Handles the AccountEditionFailed event.
	 * Sends the error message to every admin.
	 */
	public void accountEditionFailedEventHandler(AccountEditionFailedEventArgs args) {
		this.send(args.getMessage());
	}


	/**
	 * Handles the AccountEditionSuccessful event.
	 * Sends a confirmation message to every admin.
	 */
	public void accountEditionSuccessfulEventHandler(AccountEditionSuccessfulEventArgs args) {
		this.send(args.getMessage());
	}


	/**
	 * Handles the AccountRemotionFailed event.
	 * Sends the error message to every admin.
	 */
	public void accountRemotionFailedEventHandler(AccountRemotionFailedEventArgs args) {
		this.send(args.getMessage());
	}


	/**
	 * Handles the AccountRemotionSuccessful event.
	 * Sends a confirmation message to every admin.
	 */
	public void accountRemotionSuccessfulEventHandler(AccountRemotionSuccessfulEventArgs args) {
		this.send(args.getMessage());
	}
	
	
	/**
	 * Handles the ListPluginsReply event.
	 * Sends the list of plugins to the admin who requested it.
	 */
	public void listPluginsReplyEventHandler(ListPluginsReplyEventArgs args) {
		if (args.getLogin().equals(this.getLogin()))
			this.send(args.getMessage());
	}


	/**
	 * Handles the PluginOperationFailed event.
	 * Sends the response message to every admin.
	 */
	public void pluginOperationFailedEventHandler(PluginOperationFailedEventArgs args) {
		this.send(args.getMessage());
	}


	/**
	 * Handles the PluginOperationSuccessful event.
	 * Sends the response message to every admin.
	 */
	public void pluginOperationSuccessfulEventHandler(PluginOperationSuccessfulEventArgs args) {
		this.send(args.getMessage());
	}

	
	private static final long serialVersionUID = 1L;
}
